package com.neasho.neashoadminv1.infrastructure.domain.sys

import com.neasho.neashoadminv1.infrastructure.domain.base.BasePermissionEntity
import org.babyfish.jimmer.sql.*

/**
 * 系统 - 用户表
 */
@Entity
@Table(name = "sys_user")
interface SysUser: BasePermissionEntity {

    /**
     * 用户名
     */
    @Key
    val username: String

    /**
     * 密码
     */
    val password: String?

    /**
     * 手机号
     */
    val mobile: String?

    /**
     * 部门
     */
    @ManyToOne
    @JoinColumn(name = "dept_id")
    val dept: SysDept?

    /**
     * 用户的角色
     */
    @ManyToMany
    @JoinTable(
        name = "sys_user_role",
        joinColumnName = "user_id",
        inverseJoinColumnName = "role_id"
    )
    val roles: List<SysRole>
}

